POV-Ray : Newsgroups : povray.unofficial.patches : UVPOV 5.2a parser bug : Re: UVPOV 5.2a parser bug Server Time
2 Sep 2024 22:16:15 EDT (-0400)
  Re: UVPOV 5.2a parser bug  
From: Ron Parker
Date: 16 Jun 1999 10:57:13
Message: <3767bb49@news.povray.org>
On Wed, 16 Jun 1999 16:35:20 +0200, Thorsten Froehlich wrote:
>In article <3766F4D6.DFC19439@Kopp.com> , Nathan Kopp <Nat### [at] Koppcom>  
>wrote:
>
>> That's how you do layered textures.  And this parser keeps looking harder
>> and harder to fix.  :-(  ...and it looked so easy at first.
>
>Yes, layered textures _inside_ object declarations, but if I read this right
>
>#declare T_Wood34 =
>texture { T_Wood32 }
>texture  { ... }
>
>should (or will) only declare
>
>#declare T_Wood34 =
>texture { T_Wood32 }

From the documentation, the section on layered textures:

---------------
    Layered textures may be declared. For example

    #declare Layered_Examp = 
      texture {T1}
      texture {T2}
      texture {T3}
---------------

In fact, there are places you can't use a layered texture directly
but you may use a declared one.  From the same page in the docs:

---------------
    If you wish to use a layered texture in a block pattern, such as 
    checker, hexagon, or brick, or in a material_map, you must declare 
    it first and then reference it inside a single texture statement.
---------------

And here's the code from the parser, from parse.c in the function 
Parse_RValue.  The interior EXPECT loop takes care of any remaining 
texture definitions after the first one, linking them to form a 
layered texture.  

---------------
    CASE (TEXTURE_TOKEN)
      Parse_Begin ();
      Local_Texture = Parse_Texture ();
      Parse_End ();
      Temp_Texture=NULL;
      Link_Textures(&Temp_Texture, Local_Texture);
      Ok_To_Declare = FALSE;
      EXPECT
	CASE (TEXTURE_TOKEN)
	  Parse_Begin ();
	  Local_Texture = Parse_Texture ();
	  Parse_End ();
	  Link_Textures(&Temp_Texture, Local_Texture);
	END_CASE

	OTHERWISE
	  UNGET
	  EXIT
	END_CASE
      END_EXPECT

      *NumberPtr    = TEXTURE_ID_TOKEN;
      Test_Redefine(Previous,NumberPtr,*DataPtr);
      *DataPtr      = (void *)Temp_Texture;
      Ok_To_Declare = TRUE;
      EXIT
    END_CASE
---------------


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.